package com.kancy.vip.pattern.factory.abstractfactory;

import com.kancy.vip.pattern.factory.Computer;
import com.kancy.vip.pattern.factory.Phone;
import com.kancy.vip.pattern.factory.products.DellComputer;
import com.kancy.vip.pattern.factory.products.LenoveComputer;

/**
 * 同样是在AProductFactory基础上扩展功能 ComputerFactory
 *
 * 也可以通过组合的方式，对AProductFactory进行扩展
 */
public class DProductFactory implements ProductFamilyFactory {
    private PhoneFactory phoneFactory;

    public DProductFactory(PhoneFactory phoneFactory) {
        this.phoneFactory = phoneFactory;
    }

    @Override
    public Computer createDell() {
        return new DellComputer();
    }

    @Override
    public Computer createLenove() {
        return new LenoveComputer();
    }

    @Override
    public Phone createSanxing() {
        return phoneFactory.createSanxing();
    }
    @Override
    public Phone createHuawei() {
        return phoneFactory.createHuawei();
    }
}
